package com.gigi.enums;

import java.util.stream.Stream;

/**
 * 签到状态枚举
 */
public enum SignInRecordStateEnum {
    SHOW(0, "正常"),
    UN_SHOW(1, "缺勤"),
    LATE(2, "迟到"),
    ASK_FOR_LEAVE(3, "请假")
    ;
    private Integer code;
    private String desc;

    SignInRecordStateEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static SignInRecordStateEnum getEnumByCode(final Integer code) {
        return Stream.of(SignInRecordStateEnum.values()).filter(item -> item.code.equals(code)).findFirst().orElse(null);
    }
}
